<style>
    .problemimg{
        background: url(/admins/images/ico.png) no-repeat 0 -80px;
        background-position: -16px -80px;
        padding-right: 0px;
        height: 16px;
        width: 16px;
        text-indent: -100000px;
        display: inline;
        margin-left: 10px;
    }
    .ts3{
        background-position: -16px -80px;
    }
    .ts3_{background-position: -16px -96px;}
</style>
<div class="center">
    <div class="home">
        <div class="home_left">
            <?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
        <div class="home_right">
            <div class="weizhi">
                <h2><a href="/member/myorder">我的代购</a>
                    <i>&gt;</i>代购详情 <input type="hidden" id="orderId" name="orderId" value="<?php echo $this->order->Id;?>" /></h2>
            </div>
            <div class="wpxnr">
                <div class="wpleft">
                    <div class="wph1">
                        <h2>订单信息</h2>
                    </div>
                    <div class="wpbiao">
                        <table>
                            <tr>
                                <td class="wl">订单编号：</td>
                                <td><?php echo $this->order->OrderNum;?>
                                    <?php if($this->order->problem == Application_Model_Order::Problem_Appear || $this->order->problem == Application_Model_Order::Problem_User){ ?>
                                        <a class="indexa setProblem" href="javascript:void(0)" title="问题代购"><span class="ts3 problemimg"  title="点击查看代购问题详情">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
                                    <?php } else if ($this->order->problem == Application_Model_Order::Problem_Complete) { ?>
                                        <a class="indexa setProblem" href="javascript:void(0)" title="问题代购"><span class="ts3_ problemimg"  title="点击查看代购问题详情">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="wl">创建时间：</td>
                                <td><?php echo $this->order->dateCreated; ?></td>
                            </tr>
                            <tr>
                                <td class="wl">付款时间：</td>
                                <td><?php echo $this->order->datePaid?$this->order->datePaid:"暂无"; ?></td>
                            </tr>
                            <tr>
                                <td class="wl">预定发货时间：</td>
                                <td><?php echo $this->order->DateShip?$this->order->DateShip:"暂无";?></td>
                            </tr>
                        </table>
                    </div>
                    <div class="wpbiao">
                        <table>
                            <tr>
                                <td class="wl">快递公司：</td>
                                <td><?php echo $this->order->LogisticsBy?$this->order->LogisticsBy->Name:"暂无";?></td>
                            </tr>
                            <tr>
                                <td class="wl">快递单号：</td>
                                <td><?php echo $this->order->LogisticsNo?$this->order->LogisticsNo:"暂无";?></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="wpright">
                    <div class="ztbox">
                        <i></i>
                        <div class="wpzt">
                            <h2 class="f60">物品状态：<?php echo $this->order->StatusText ?></h2>
                            <p>最后操作时间：<?php echo $this->order->dateConfrim;?></p>   
                        </div>
                    </div>
                </div>
            </div>
            <div class="daigouxinfo">
                <div class="lmb" style="margin-bottom: 0px;">
                    <h2>物品信息</h2>
                </div>
                <div class="daigouwupin">
                    <table class="NewDD">
                        <tr>
                            <th class="l1">商品信息</th>
                            <th class="l2">价格</th>
                            <th class="l3">数量</th>
                            <th class="l4">说明</th>
                        </tr>
                        <?php $shopDetail = $this->order->shipdetail;
                            foreach ($shopDetail as $shopVal) {
                                $productd = $shopVal->byproductd;
                        ?>
                        <tr>
                            <td class="l1">
                                <div class="sp_pic">
                                    <a href="<?php echo $shopVal->taoBaoUrl?$shopVal->taoBaoUrl:$productd->url; ?>" target="_blank">
                                        <img src="<?php echo $productd->image ? $productd->image : $productd->remoteImage; ?>" width="50px" height="50px" style="vertical-align:middle;"/></a>
                                </div>
                                <div class="sp_info">
                                    <h1><a href="<?php echo $shopVal->taoBaoUrl?$shopVal->taoBaoUrl:$productd->url; ?>" target="_blank" class="indexa"><?php echo $shopVal->productName; ?></a></h1>
                                    <div class="zdy">
                                        <span><?php echo $productd->PropertyAlias; ?></span>
                                    </div>
                                    <div class="Remarks">
                                        <p>商品备注:<?php echo $shopVal->comment ? $shopVal->comment : "(无)"; ?></p>
                                    </div>
                                    <div class="YQRemarks">
                                        <p>悠奇备注:<?php echo $shopVal->description ? $shopVal->description : "(无)"; ?></p>
                                    </div>
                                </div>
                            </td>
                            <td class="l2"><?php echo $shopVal->price;?></td>
                            <td class="l3"><?php echo $shopVal->quantity;?></td>
                            <td class="l4"><?php 
                                            if($shopVal->problemContent != null && $shopVal->problemContent != ""){
                                                echo '<span class="c00">'.$shopVal->problemContent.'</span>';
                                            } else {
                                                echo $shopVal->status==1?"已单项退款":"已验";
                                            } ?></td>
                        </tr>
                        <?php } ?>
                    </table>
                </div>
            </div>
            <?php if($this->order->IsAbnormal != Application_Model_Order::Abnormal_Default && $this->order->problemContent != ""){ ?>
                <div class="zizhuwupin">
                    <div class="lmb" style="margin-bottom: 0px;">
                        <h2>异常信息</h2>
                    </div>
                    <div class="wpnr">
                        <p style="color:#c00;padding-left: 10px;"><?php echo $this->order->problemContent; ?></p>
                    </div>
                </div>
            <?php  }?>
            <div class="zizhuwupin">
                <div class="lmb" style="margin-bottom: 0px;">
                    <h2>操作日志</h2>
                </div>
                <div class="wpnr">
                    <?php if($this->tracklog){ ?>
                        <?php foreach ($this->tracklog as $trackVal) { ?>
                            <p style="padding-left: 10px;"><span><?php echo $trackVal->dateAdd;?></span><span style="margin-left: 10px;"><?php echo $trackVal->content;?></span></p>
                        <?php }?>
                    <?php } else { ?>
                        <p style="padding-left: 10px;">暂无数据</p>
                    <?php } ?>
                </div>
            </div>
            <div class="zizhuwupin">
                <div class="lmb" style="margin-bottom: 0px;">
                    <h2>物流跟踪</h2>
                </div>
                <div class="wpnr expressgz" style="margin-bottom: 20px;">
                    <?php if($this->order->logisticsNo != ""){ ?>
                        物流状态加载中...
                        <script type="text/javascript">
                            $(function(){
                                $.post('/member/getingexpress', {type:3,id:<?php echo $this->order->Id;?>}, function(data){
                                    $(".expressgz").html(data.content);
                                }, 'json').fail(function(){$(".expressgz").html('出错了!')});
                            })
                        </script>
                    <?php } else {
                        echo "暂无数据";
                    } ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php if($this->order->problem > Application_Model_Order::Problem_Default){ ?>
<div id="ProblemOrder" class="tanchuang" style="display:none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="wayProblem">问题代购</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
    	<div class="wt_nav">
            <ul>
            	<li class="wt_on"><a href="javascript:void(0)" id="problem">问题详情</a></li>
            </ul>
        </div>
    </div>
    <div class="wt_center" style="height:<?php echo ($this->order->problem == Application_Model_Order::Problem_Appear || $this->order->problem == Application_Model_Order::Problem_User)?"300px":"380px";?>;">
            
    </div>
    <?php if($this->order->problem == Application_Model_Order::Problem_Appear || $this->order->problem == Application_Model_Order::Problem_User){  ?>
        <div class="wt_caozuo">
            <textarea name="content" cols="" rows="" id="content"></textarea>
            <input type="hidden" id="orderProblemId" name="orderProblemId" value="" />
            <a class="wt_liuyan" href="javascript:void(0);"><span>留言</span></a>
        </div>
    <?php } ?>
</div>
<div class="houtai_overlay" style="display:none;"></div>
<?php } ?>
<script type="text/javascript">
    $(function(){
        $(".nui-msgbox-close").click(function(){
            $("#ProblemOrder").hide();
            $(".houtai_overlay").hide();
        });
        /**
        * 设置问题展示
        */
       $(".setProblem").click(function(){
           var orderId = $("#orderId").val();
           $.ajax({
               type: 'POST',
               url: '/member/problemshow/orderId/' + orderId,
               success: function(data) {
                   if (data.type == 1) {
                       var html = "";
                       $.each(data.arrProblem, function(key, val) {
                           html += '<div class="'+(val.issueetype==1?'wt_uuch':'wt_kehu')+'">';
                           html += '<h2>'+(val.issueetype==1?'悠奇客服':('回复人：'+val.userName));
                           html += '<span>'+val.dateCreated+'</span></h2>';
                           html += '<p>'+val.content+'</p></div>';
                       });
                       $(".wt_caozuo").show();
                       if(data.status){
                            $(".wt_caozuo").hide();
                       }
                       $("#ProblemOrder .wt_center").html(html);
                       $("#ProblemOrder").show();
                       $(".houtai_overlay").show();
                   } else {
                       alert("发生未知错误，请重新操作");
                   }
               }
           });
       });
       /**
       * 提交回复记录
        */
       $(".wt_liuyan").click(function(){
           var orderProblemId = $("#orderId").val();
           var content = $("#content").val();
           
           if($.trim(content) == ""){
                alert("回复内容不能为空！");
                return false;
           }
           $.post('/member/addorderpb',{'orderProblemId':orderProblemId,'content':content},function(data){
               if(data ==1){
                       alert("设置成功！");
                       $(".problem"+orderProblemId).show();
                       $("#content").val("");
                       $(".nui-msgbox-close").click();
                   }else if (data == 2){
                       alert("回复内容不能为空！");
                   } else {
                       alert("发生未知错误，请重新操作");
                   }
           }); 
       });
       });
           
</script>
